<?php

use Illuminate\Database\Seeder;
use App\Admin;
class UserSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        factory (Admin::class,1)->create();
        $admin=Admin::first();
        $admin->name='webmaster';
        $admin->nickname='站长';
        $admin->password=bcrypt('admin888');
        $admin->save();
		//手动添加一个站长的角色
		\Spatie\Permission\Models\Role::create([
			'name' => 'webmaster',
			'title' => '网站站长',
			'guard_name' => 'admin'
		]);
		//将默认的admin用户设置站长角色
		$admin->syncRoles('webmaster');
    }
}
